package com.kkkk.rest.common.exception;


import com.kkkk.rest.common.exception.code.ErrorCode;
import com.kkkk.rest.common.exception.code.ErrorCodeTypeEnums;

public enum CommonErrorCodeEnum implements ErrorCode {
    SUCCESS("00000", "ok"),
    /**
     * 未知错误
     */
    UNKNOWN_ERROR(ErrorCodeTypeEnums.BASE.getCode() + "000001", "未知错误"),

    /**
     * 缺少要求的http body
     */
    MISSING_REQUIRED_HTTP_BODY(ErrorCodeTypeEnums.CLIENT.getCode() + "000001", "缺少要求的http body"),

    /**
     * 要求数字，但传参不是数字
     */
    NUMBER_FORMAT_EXCEPTION(ErrorCodeTypeEnums.CLIENT.getCode() + "000002", "要求数字，但传参不是数字"),

    /**
     * 参数校验失败
     */
    VALIDATION_ERROR(ErrorCodeTypeEnums.CLIENT.getCode() + "000003", "参数校验失败"),

    /**
     * 不支持的HTTP方法
     */
    HTTP_METHOD_NOT_SUPPORTED(ErrorCodeTypeEnums.CLIENT.getCode() + "000004", "不支持的HTTP方法"),

    /**
     * 参数类型不匹配
     */
    ARGUMENT_TYPE_MISMATCH(ErrorCodeTypeEnums.CLIENT.getCode() + "000005", "参数类型不匹配"),

    /**
     * 缺失Path Variable
     */
    MISSING_PATH_VARIABLE(ErrorCodeTypeEnums.CLIENT.getCode() + "000006", "缺失Path Variable"),
    /**
     * 非法的请求
     */
    ILLEGAL_REQUEST(ErrorCodeTypeEnums.CLIENT.getCode() + "000007", "非法的请求"),
    /**
     * 错误的请求
     */
    BAD_REQUEST(ErrorCodeTypeEnums.CLIENT.getCode() + "000008", "错误的请求"),
    /**
     * 错误的请求参数
     */
    BAD_PARAMETERS(ErrorCodeTypeEnums.CLIENT.getCode() + "000009", "错误的请求参数"),
    /**
     * 内部错误
     */
    INTERNAL_SERVER_ERROR(ErrorCodeTypeEnums.SYSTEM.getCode() + "000010", "内部错误"),
    /**
     * Feign Exception
     */
    FEIGN_EXCEPTION(ErrorCodeTypeEnums.DATA.getCode() + "000011", "Feign Exception"),

    INDEX_KEY_EXIST(ErrorCodeTypeEnums.DATA.getCode() + "000012", "重复的键"),
//    /**
//     * MappingException
//     */
//    MAPPING_EXCEPTION("0000000012","MappingException"),
    /**
     * DataIntegrityViolationException
     */
    DATA_INTEGRITY_VIOLATION_EXCEPTION(ErrorCodeTypeEnums.DATA.getCode() + "000013", "DataIntegrityViolationException");


    private String code;


    private String message;

    CommonErrorCodeEnum(String code, String msg) {
        this.code = code;
        this.message = msg;
    }


    @Override
    public String getMessage() {
        return this.message;
    }

    @Override
    public String getCode() {
        return this.code;
    }


}
